function HandlePageBackendUser(gui, operator, now, options) {
  this._gui = gui;
  this._operator = operator;
  this._now = now;
  this._options = options;
  
  this._createElements();
};

HandlePageBackendUser.prototype._createElements = function() {
  this._loadData();
};

HandlePageBackendUser.prototype._loadData = function() {
  this._user = null;
  this._retrieveUser();
};

HandlePageBackendUser.prototype._verifyData = function() {
  if (this._user) {
    this._updateElements();
  }
};

HandlePageBackendUser.prototype._retrieveUser = function() {
  var _self = this;
  if (this._options.id) {
    new RequestUtils()._read('pz_user', null, 'd.oid=' + this._options.id, null, null, null, null, function(result, params) { _self._user = (result.data.length == 1) ? result.data[0] : null;
                                                                                                     _self._verifyData.call(_self);
                                                                                                   }, null);
  } else {
    this._user = pz_user.instance();
    this._verifyData();
  }
};

HandlePageBackendUser.prototype._updateElements = function() {
  var table, tr, td, _self = this;
  DlmanageUtils.clear(this._gui);
  
  this._gui.type.options[this._gui.type.options.length] = new Option('');
  for (var i = 0, il = UserType.array().length; i < il; i++) {
    var type = UserType.array()[i];
    if (this._operator.type == Constant.USER_TYPE_STAFF) {
      if (type == Constant.USER_TYPE_ADMINISTER) {
        continue;
      }
    }
    option = new Option(type);
    this._gui.type.options[this._gui.type.options.length] = option;
    if (option.text == this._user.type) {
      this._gui.type.selectedIndex = this._gui.type.options.length - 1;
    }
  }
  this._gui.account.value = this._user.account;
  this._gui.email.value = this._user.email;
  this._gui.name.value = this._user.name;
  this._gui.password.value = this._user.password;

  this._gui.account.onchange = function() { _self._user.account = this.value; };
  this._gui.email.onchange = function() { _self._user.email = this.value; };
  this._gui.name.onchange = function() { _self._user.name = this.value; };
  this._gui.password.onchange = function() { _self._user.password = this.value; };
  this._gui.type.onchange = function() { _self._user.type = this.options[this.selectedIndex].text; };
  
  this._gui.save.onclick = function() { var str = '';
                                        if (_self._user.account == '') {
                                          str += '帐号, ';
                                        }
                                        if (_self._user.password == '') {
                                          str += '密码, ';
                                        }
                                        if (_self._user.type == '') {
                                          str += '用户类型, ';
                                        }
                                        if (_self._user.account == '' || _self._user.password == '' || _self._user.type == '') {
                                          window.alert(str.substring(0, str.length-2) + ' 不能为空');
                                        } else {
                                          new RequestUtils()._write('pz_user', [_self._user], [], function() { history.back(); }, {pos: DOMUtils.findPos(this)});
                                        }
                                      };
  this._gui.cancel.onclick = function() { history.back(); };
};
